using System.Collections.Generic;
using Framework.Save.Interface;
using Framework.Utils;

namespace Framework.Save
{
    public class SaveConfig
    {

        /// <summary>
        /// 存储根目录
        /// </summary>
        public string RootPath;

        internal ISaveHandler    _saveHandler;
        internal ISaveSerializer _saveSerializer;

        private SaveConfig() { }

        public static SaveConfig CreateConfig(string rootPath = null)
        {
            if (string.IsNullOrEmpty(rootPath))
                rootPath = FileHelper.UnityRootPath + "/save";
            var config = new SaveConfig();
            config.RootPath        = rootPath;
            config._saveHandler    = new SaveHandlerFileStream();
            config._saveSerializer = new SaveSerializerJson();
            return config;
        }

        public SaveConfig SetDataHandler(ISaveHandler saveHandler)
        {
            this._saveHandler = saveHandler;
            return this;
        }

        public SaveConfig SetSerializer(ISaveSerializer serializer)
        {
            this._saveSerializer = serializer;
            return this;
        }

    }
}